import { BaseCommand, TSelectRanage, TMergeCell } from '../types/common.interface';
import { TableDatas } from '../cors/table-datas';
import { RenderTrigger } from '../cors/render-trigger';
export class MergeCommand extends BaseCommand {
    protected pastMergeCells: TMergeCell[] = [];
    constructor(
        protected datas: TableDatas
        , protected range: TSelectRanage
        , protected render: RenderTrigger
        ) {
        super();
    }
    public execute() {
        this.pastMergeCells = this.datas.mergeCell.getMergedCells();
        this.datas.mergeCell.add(this.range);
        this.render.triggerRenderAll();
        return true;
    }
    public redo() {
        this.datas.mergeCell.setMergedCells(this.pastMergeCells);
        this.render.triggerRenderAll();
        return true;
    }
}